Page({
  data: {
    test: [],
    id: 1,
  },

  onLoad(options) {
    console.log(options);
    this.setData({
      id: options.id || this.data.id
    }, () => {
      this.loadTestList();
    });
  },

  loadTestList() {
    //http://localhost:8080/psycTest/page?classificationId=${this.data.id}
    wx.request({
      url: `http://localhost:8080/psyknoTest/pages?sort=${this.data.id}`,
      method: "GET",
      success: (res) => {
        console.log('分类下的文章列表：',res)
        this.setData({
          test: res.data.data.list || []
        });
        console.log(res);
      },
      fail: (err) => {
        wx.showToast({
          title: '加载失败',
          icon: 'none'
        });
      },
      complete: () => {
        this.setData({
          loading: false
        });
      }
    });
  },

  // 下拉刷新
  onPullDownRefresh() {},

  onReachBottom() {

  }
});